API Documentation
Matrix.h
1 // Matrix.h
3 //
5 
6 namespace nkMaths
7 {
11  class DLL_GRAPHICS_EXPORT Matrix : public ByteAlignedClass<16>
12  {
13  public :
14 
18  Matrix () ;
39  Matrix (float x0, float y0, float z0, float w0, float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float x3, float y3, float z3, float w3) ;
45  Matrix (const Matrix& other) ;
51  Matrix (const DirectX::XMMATRIX& values) ;
55  ~Matrix () ;
56 
57  // Getters
63  DirectX::XMMATRIX getValues () const ;
67  Matrix getInverse () const ;
71  Matrix getTranspose () const ;
91  void getDecomposed (Vector& position, Quaternion& orientation, Vector& scale) ;
95  Vector getFirstRow () const ;
99  Vector getSecondRow () const ;
103  Vector getThirdRow () const ;
107  Vector getFourthRow () const ;
108 
115 
123  void setToViewMatrixDirection (const Vector& position, const Vector& direction, const Vector& upDirection) ;
132  void setToPerspectiveMatrix (float fov, float aspect, float nearVal, float farVal) ;
142  void setToOrthographicMatrix (float fov, float camSpaceWidth, float camSpaceHeight, float nearVal, float farVal) ;
150  void setToTransformation (const Vector& position, const Quaternion& orientation, const Vector& scale) ;
154  void inverse () ;
158  void transpose () ;
159 
165  float get (unsigned int row, unsigned int col) const ;
171  void set (float val, unsigned int row, unsigned int col) ;
172 
176  float getDeterminantMat3 () const ;
180  float getDeterminantMat4 () const ;
184  float getTraceMat3 () const ;
188  float getTraceMat4 () const ;
189 
196  void fromString (const std::string_view& str) ;
197 
198  // Operators
205  Matrix& operator= (const Matrix& other) ;
212  bool operator== (const Matrix& other) ;
219  bool operator!= (const Matrix& other) ;
226  Matrix operator+ (const Matrix& other) const ;
232  void operator+= (const Matrix& other) ;
239  Matrix operator- (const Matrix& other) const ;
245  void operator-= (const Matrix& other) ;
252  Matrix operator* (const Matrix& other) const ;
259  Vector operator* (const Vector& toApply) const ;
266  Matrix operator* (float scalar) const ;
272  void operator*= (const Matrix& other) ;
278  void operator*= (float scalar) ;
285  Matrix operator/ (float scalar) const ;
291  void operator /= (float scalar) ;
292  } ;
293 }
nkMaths::Matrix::getTraceMat4
float getTraceMat4() const
nkMaths::Matrix::setToOrthographicMatrix
void setToOrthographicMatrix(float fov, float camSpaceWidth, float camSpaceHeight, float nearVal, float farVal)
nkMaths::Matrix::~Matrix
~Matrix()
nkMaths::Matrix::getDecomposed
void getDecomposed(Vector &position, Quaternion &orientation, Vector &scale)
nkMaths
Encompasses all API of component NilkinsMaths.
Definition: IVector.h:7
nkMaths::Matrix::setToTransformation
void setToTransformation(const Vector &position, const Quaternion &orientation, const Vector &scale)
nkMaths::Matrix::setToViewMatrixDirection
void setToViewMatrixDirection(const Vector &position, const Vector &direction, const Vector &upDirection)
nkMaths::Matrix::getThirdRow
Vector getThirdRow() const
nkMaths::Quaternion
A quaternion, symbolizing rotations as a 4D vector.
Definition: Quaternion.h:12
nkMaths::Matrix::getTraceMat3
float getTraceMat3() const
nkMaths::Matrix::getFirstRow
Vector getFirstRow() const
nkMaths::Matrix
Represents a 4x4 float matrix.
Definition: Matrix.h:12
nkMaths::Matrix::getScaleComponent
Vector getScaleComponent() const
nkMaths::Matrix::Matrix
Matrix()
nkMaths::Matrix::inverse
void inverse()
nkMaths::Matrix::getFourthRow
Vector getFourthRow() const
nkMaths::Matrix::getDeterminantMat3
float getDeterminantMat3() const
nkMaths::Matrix::getValues
DirectX::XMMATRIX getValues() const
nkMaths::Matrix::getDeterminantMat4
float getDeterminantMat4() const
nkMaths::Matrix::set
void set(float val, unsigned int row, unsigned int col)
nkMaths::Matrix::getInverse
Matrix getInverse() const
nkMaths::Matrix::Matrix
Matrix(const DirectX::XMMATRIX &values)
nkMaths::Matrix::setToRotationFromQuaternion
void setToRotationFromQuaternion(const Quaternion &origin)
nkMaths::Matrix::fromString
void fromString(const std::string_view &str)
nkMaths::Matrix::Matrix
Matrix(const Matrix &other)
nkMaths::Matrix::Matrix
Matrix(float x0, float y0, float z0, float w0, float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float x3, float y3, float z3, float w3)
nkMaths::Matrix::getPositionComponent
Vector getPositionComponent() const
nkMaths::Vector
A 4-component vector class, with floats.
Definition: Vector.h:12
nkMaths::Matrix::getSecondRow
Vector getSecondRow() const
nkMaths::Matrix::setToPerspectiveMatrix
void setToPerspectiveMatrix(float fov, float aspect, float nearVal, float farVal)
nkMaths::Matrix::transpose
void transpose()
nkMaths::Matrix::get
float get(unsigned int row, unsigned int col) const
nkMaths::Matrix::getTranspose
Matrix getTranspose() const
nkMaths::Matrix::getOrientationComponent
Quaternion getOrientationComponent() const